package com.lmf.springboot.config;

import com.lmf.springboot.servlet.MyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.ServletRegistration;

@Configuration
public class ServletConfig {
    //@Bean 是一个方法级别上的注解，主要用在配置类里
    /*
     * 相当于一个<beans>
     * <bean id="" class=""/>
     * </beans>
     * */
    @Bean
    public ServletRegistrationBean myServletRegistrationBean(){
        ServletRegistrationBean registrationBean=new ServletRegistrationBean(new MyServlet(),"/myServlet");
        return registrationBean;
    }
}
